package xyz.zenheart.ffmpegrelay.config;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

/**
 * <p>项目名称: screen-monitor </p>
 * <p>描述: TODO </p>
 * <p>创建时间: 2021/9/13 </p>
 * <p>公司信息: 维之星研发部</p>
 *
 * @author CKM
 * @version v1.0
 */
@Configuration
public class ThreadConfig {

    @Bean
    @Qualifier("videoThreadFactory")
    public ExecutorService videoThreadFactory() {
        int corePoolSize = 4;
        int maxPoolSize = 50;
        long aliveTime = 60L;
        return new ThreadPoolExecutor(corePoolSize, maxPoolSize, aliveTime, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10), Executors.defaultThreadFactory());
    }
}
